package leet.ku._242;

public class Solution {
	
    public boolean isAnagram(String s, String t) {
        int[] sChars = count(s);
        int[] tChars = count(t);
        for (int i = 0; i < 26; i++)
        	if (sChars[i] != tChars[i])
        		return false;
        return true;
    }
    
    private int[] count(String s) {
    	int[] result = new int[26];
    	for (int i = 0; i < s.length(); i++)
    		result[s.charAt(i) - 'a']++;
    	return result;
    }
}